home *** CD-ROM | disk | FTP | other *** search
/ New Star Software Collection / NSS_Collection.iso / 5-029 turbo debugger and assem / disks.7z / 1 / HELPME!.DOC next >
Encoding:
Text File  |  1988-08-28  |  13.6 KB  |  345 lines

  1. TURBO DEBUGGER 1.0: COMMON QUESTIONS AND ANSWERS
  2. ------------------------------------------------
  3.  
  4.   Q. How does TD handle screen output for graphics- and text-based
  5.      programs?
  6.  
  7.   A. Turbo debugger has a number of strategies that it can use to
  8.      control how and when the screen gets refreshed. If you are
  9.      debugging a program that uses a graphics display mode or if
  10.      you want to use Borland pop-up utilities such as SideKick
  11.      and SideKick Plus while inside Turbo Debugger, you should
  12.      review the following hints.
  13.  
  14.      The default screen-updating mode is "Flip," meaning that
  15.      Turbo Debugger uses an alternate video display page on
  16.      adapters that support multiple display pages. This results
  17.      in fast screen-swapping between Turbo Debugger and your
  18.      program, but it also can interfere with the operation of
  19.      pop-up utilities and graphics programs.
  20.  
  21.      Pop-up utilities may not appear on the screen, even though
  22.      they are active and processing your keystrokes. You must
  23.      select "Swap" mode for display-updating in order for pop-ups
  24.      to work properly. Use Turbo Debugger's -ds command-line
  25.      option to do this, or use the TDINST utility to permanently
  26.      set this mode. "Swap" mode makes screen updating slower, but
  27.      it makes sure that Turbo Debugger's screen does not
  28.      interfere with either your program's or any pop-up's
  29.      display.
  30.  
  31.      You may also need to use "Swap" when you use the OS Shell
  32.      command or run an editor from within TD. Most programs
  33.      expect to run on video page 0, and do not check to see what
  34.      the current video page is. TD's OS Shell and any editors
  35.      that TD runs in "Flip" mode do not run from video page 0,
  36.      and the programs may appear to hang, even though you will be
  37.      able to type in keystrokes normally. If this happens, use
  38.      the -ds command-line option when you run TD or reinstall TD
  39.      to use "Swap" instead of "Flip."
  40.  
  41.      If you are debugging a graphics mode application, you must
  42.      specify the -ds command-line option ("Swap" contents) and
  43.      you may want to use Turbo Debugger's -vg command-line
  44.      option (Graphics Save). This causes additional memory to be
  45.      set aside for saving the entire graphics image that your
  46.      program produces. If you don't use this option, a "red
  47.      cloud" may appear on your program's screen. These options
  48.      can also be set permanently by using the TDINST program.
  49.      The Graphics Save option takes an additional 8K of memory
  50.      and slows screen-swapping.
  51.  
  52.      If you are running a graphics program that changes the EGA
  53.      palette, make sure that you use the -vp command line option
  54.      to save the palette.
  55.  
  56.   Q. Can Turbo Debugger execute other programs while you are
  57.      still using the debugger?
  58.  
  59.   A. The OS Shell and Edit commands in the Module and File
  60.      windows can swap the program you are debugging to disk in
  61.      order to make room to run DOS or your editor. The default
  62.      amount of memory to swap is 128K. You can use TDINST to set a
  63.      different amount if that's not enough memory to run your
  64.      editor or other programs. Setting the swap size to 0K tells
  65.      Turbo Debugger to swap the entire user program to disk
  66.      before running the DOS command processor.
  67.  
  68.      Only your program gets swapped to disk, Turbo Debugger
  69.      remains in memory.
  70.  
  71.   Q. How can I break out of a program even though interrupts are
  72.      disabled?
  73.  
  74.   A. If you have an 80386-chip-based computer and are using
  75.      TD386, option -B allows break even when interrupts are
  76.      disabled. For example, this option enables a break from
  77.  
  78.        CLI
  79.        JMP $
  80.  
  81.   Q. Why can't I hit Ctrl-Break to get out of a program
  82.      running on a remote machine?
  83.  
  84.   A. The program running in the remote machine has taken control
  85.      of Interrupt 1B (Ctrl-Break), TDREMOTE does not take back
  86.      control of Interrupt 1B until you stop execution of the
  87.      running program on the debugger side by completing the
  88.      program or hitting Ctrl-F2 (Program Reset).
  89.  
  90.  
  91.   Q. What are some of the syntactic and parsing differences
  92.      between Turbo Debugger's built-in assembler and the
  93.      standalone Turbo Assembler?
  94.  
  95.   A. The following short example program is discussed in the
  96.      text that follows it:
  97.  
  98.               .model small
  99.               .data
  100.  
  101.        abc    struc
  102.        mem1   dd      ?
  103.        mem2   db      ?
  104.        mem3   db      "   "
  105.        abc    ends
  106.  
  107.               align   16
  108.        a      abc     <1,2,"xyz">
  109.  
  110.        msg1   db      "testing 1 2 3", 0
  111.        msg2   db      "hello world", 0
  112.        nmptr  dw      msg1
  113.        fmptr  dd      msg1,msg2
  114.        nfmptr dw      fmptr
  115.        xx     dw      seg a
  116.  
  117.               .code
  118.  
  119.               push   cs
  120.               pop    ds
  121.               mov    bx,offset a
  122.               mov    bx,nmptr
  123.               les    si,fmptr
  124.               mov    ah,4ch
  125.               int    21h
  126.               end
  127.  
  128.      The assembler expression parser does not accept all legal
  129.      TASM instruction operands. This allows TD's assembler
  130.      expressions to be more general and allow multiple levels of
  131.      memory-referencing, more like that used in C and Pascal.
  132.      However, there are a few constructs that you may be used to
  133.      using that you will have to specify differently for the TD
  134.      assembler expression parser to accept them:
  135.  
  136.        a. Size overrides should always appear inside the
  137.           brackets; PTR is optional after the size. Also, when
  138.           referring to a structure, you must use the name of the
  139.           struc, not the name of the variable:
  140.  
  141.           CORRECT:  [byte ptr bx]   [dword si]        [abc bx]
  142.  
  143.           INCORRECT: byte ptr[bx]    [struc abc bx]    [a bx]
  144.  
  145.        b. You must specify a structure name when accessing the
  146.           members of a structure via a register pointer:
  147.  
  148.           CORRECT:  [abc ptr bx].mem1  [abc bx].mem3 + 1
  149.  
  150.           INCORRECT: [bx].mem1
  151.  
  152.        c. You can't use multiple instances of [] unless they are
  153.           adjacent, and you can only follow an [] expression with
  154.           a dot and a structure member name or another []
  155.           expression:
  156.  
  157.           CORRECT:  4[bx][si]    [abc bx].mem2
  158.  
  159.           INCORRECT: [bx]4[si]    [bx]+4
  160.  
  161.        d. If you use a register as part of a memory expression
  162.           and you don't specify a size, WORD is assumed:
  163.  
  164.             [bx] is the same as [word bx]
  165.  
  166.        e. You can use any register you want between [], not just
  167.           the combinations of BX, BP, SI, and DI allowed in
  168.           instruction operands:
  169.  
  170.           CORRECT:  [ax+bx]   [bx+sp]
  171.  
  172.        f. You can use multiple levels of [] to follow chains of
  173.           pointers:
  174.  
  175.           CORRECT:  [byte [[nfmptr]+4]]
  176.  
  177.        g. Be careful using registers to access memory locations.
  178.           You may get unexpected results if your segment
  179.           registers are not set up properly. If you don't
  180.           explicitly specify a segment register, Turbo Debugger
  181.           uses the DS register to reference memory.
  182.  
  183.        h. When you do specify a segment register, make sure that
  184.           you follow the same rule as for size overrides: put it
  185.           INSIDE the brackets:
  186.  
  187.           CORRECT:  [byte es:di]    [es:fmptr]
  188.  
  189.           INCORRECT: es:[byte di]
  190.  
  191.        i. Use the OFFSET operator to get the address of a
  192.           variable or structure. Turbo Debugger automatically
  193.           supplies the [] around a variable name if you just type
  194.           the variable name alone:
  195.  
  196.             a            contents of structure a
  197.             [a]          contents of structure a
  198.             offset a     address of structure a
  199.  
  200.        j. You can use the type overrides and the format control
  201.           count to examine any area of memory displayed as you
  202.           wish:
  203.  
  204.             [byte es:bx],10  10 bytes pointed to by es:bx
  205.             [dword ds:si],4  4 dwords pointed to by ds:si
  206.  
  207.           This is very useful when specifying watch expressions.
  208.  
  209.        k. Sometimes you use a word memory location or register to
  210.           point to a paragraph in memory that contains a data
  211.           structure. Access the structure with expressions like:
  212.  
  213.             [abc [xx]:0].mem1
  214.             [abc es:0].mem3
  215.  
  216.   Q. Are there any syntactic or parsing differences between Turbo
  217.      Debugger's C expression evaluation and Turbo C's?
  218.  
  219.   A. You can't pass constant-string arguments when evaluating
  220.      functions.
  221.  
  222.      CORRECT:  myfunc(123)   myfunc(string_variable)
  223.  
  224.      INCORRECT:  myfunc("constant")
  225.  
  226.   Q. Are there any syntactic or parsing differences between Turbo
  227.      Debugger's Pascal expression evaluation and Turbo Pascal's?
  228.  
  229.   A. The differences are:
  230.  
  231.      a. Turbo Debugger does not support expressions for set
  232.         constructors:
  233.  
  234.         CORRECT:   [4..7]
  235.  
  236.         INCORRECT: [myvar1..myvar2]   [3+4..7+8]
  237.  
  238.      b. You can't pass constant-string arguments when evaluating
  239.         functions or procedures.
  240.  
  241.         CORRECT:   MyFunc(123)   MyFunc(StringVariable)
  242.  
  243.         INCORRECT: MyFunc('Constant')
  244.  
  245.                 MyFunc(StringConstant), where StringConstant is
  246.                 defined with a "const" declaration and is not a
  247.                 typed constant.
  248.  
  249.      c. You can't evaluate procedures or functions that have
  250.         structure VALUE parameters. You can evaluate procedures or
  251.         functions that have structure VARIABLE parameters, though.
  252.  
  253.   Q. What should I be aware of when I am debugging multi-language
  254.      programs with Turbo Debugger?
  255.  
  256.   A. Turbo Debugger's default source language is "Auto," meaning
  257.      that it chooses the expression language based on the current
  258.      source module. This can cause some confusion if your program
  259.      has source modules written in different languages (like C
  260.      and assembler). Since you are actually entering a language
  261.      expression any time that Turbo Debugger prompts you for a
  262.      value or an address, this can cause some unexpected results:
  263.  
  264.      a. Even if you are in a CPU window or a Dump window, you
  265.         must still enter addresses in the source language,
  266.         despite the fact that the window is displaying in hex.
  267.         For example, to display the contents of memory address
  268.         1234:5678, you must type one of the following
  269.         expressions, depending on your current source language:
  270.  
  271.           C            0x1234:0x5678
  272.           Pascal        $1234:$5678
  273.           Assembler      1234:5678
  274.  
  275.      b. When your current language is assembler, you must be
  276.         careful when entering hex numbers, since they are
  277.         interpreted EXACTLY as they would be in an assembler
  278.         source file. This means that if you want to enter a
  279.         number that starts with one of the hex digits A - F, you
  280.         must first precede the letter with a 0 so Turbo Debugger
  281.         knows that you are entering a number. Likewise, if your
  282.         number ends in B or D (indicating a binary or decimal
  283.         number), you must add an H to indicate if you really want
  284.         a hex number:
  285.  
  286.         CORRECT:    0aaaa   123dh   89abh
  287.  
  288.         INCORRECT:  aaaa    123d    89ab
  289.  
  290.   Q. Why does the text "Cannot be changed" come up when I do an
  291.      assignment in the Data/Evaluate/Modify "New value" pane?
  292.  
  293.   A. If you use the Data/Evaluate/Modify command (Ctrl-F4) to
  294.      change a variable by direct assignment, the "New value" pane
  295.      will say "Cannot be changed." This does not mean that the
  296.      assignment did not take effect. Instead it means that the
  297.      assignment expression as a whole is not a memory-referencing
  298.      expression whose value you can change by moving to the
  299.      bottom pane. Here are some examples of direct assignment
  300.      expressions:
  301.  
  302.        C              x = 4
  303.        Pascal         ratio := 1.234
  304.        Assembler      wval = 4 shl 2
  305.  
  306.      If you had typed just "x," "ratio," or "wval" into the top
  307.      pane, then you would be able to move to the bottom pane and
  308.      enter a new value. The direct assignment method using the
  309.      "=" or ":=" assignment operator is quicker and more
  310.      convenient if you don't care about examining the value of
  311.      the variable before modifying it.
  312.  
  313.   Q. Why does an inspector occasionally display question marks
  314.      when inspecting a Turbo C register variable?
  315.  
  316.   A. If you inspect a register variable that is not in the
  317.      current scope, you'll see ???? for the value. A register
  318.      variable only displays a value if the register is in your
  319.      current scope (valid at the current location in your
  320.      program).
  321.  
  322.   Q. What is the most likely reason for Turbo Debugger to hang
  323.      when starting up on a PC-compatible computer?
  324.  
  325.   A. If your computer is a Tandy 1000A, IBM PC Convertible, or
  326.      NEC MultiSpeed, or if TD hangs when loading on your system,
  327.      run TDINST and change the last item in the Options menu so
  328.      that NMI Intercept is set to "No." Some computers use the
  329.      NMI (Non-Maskable Interrupt) in ways that conflict with TD,
  330.      so you must disable TD's use of this interrupt in order to
  331.      run the program.
  332.  
  333.      Also, if you are using a 80386-based machine and have the
  334.      SuperKey utility loaded, be careful not to press a key when
  335.      TD386 is loading, since SuperKey may capture the keystroke
  336.      and cause unexpected results.
  337.  
  338.   Q. Why do I get the message "Cannot run TD386: processor is
  339.      already in V8086 mode"?
  340.  
  341.   A. You have installed a program or device driver that uses the
  342.      80386's virtual-8086 mode (eg. 386^MAX, CEMM, QEMM). You
  343.      will have to disable or de-install those programs or device
  344.      drivers to be able to run TD386.
  345.